package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        c.add("Happy");
        c.add("New");
        c.add("Year!!");
        System.out.println(c);


        System.out.println("size:"+c.size());
        System.out.println(c.isEmpty());
        c.clear();
        System.out.println(c.isEmpty());

        Collection list = new ArrayList();
        list.add(new Point(5,6));
        list.add(new Point(5,7));
        list.add(new Point(5,6));
        list.add(new Dog("小黑",2));
        System.out.println(list);

        System.out.println(list.contains(new Point(5, 6)));
        System.out.println(list.contains(new Dog("小黑",2)));
        list.remove(new Point(5,6));
        System.out.println(list);

        Point pp = new Point(1,5);
        c.add(pp);
        System.out.println("pp:"+pp);
        System.out.println("c:"+c);

        pp.setX(500);
        System.out.println("pp:"+pp);
        System.out.println("c:"+c);
    }
}
